package com.itheima.user.controller;


import com.itheima.common.pojo.Result;
import com.itheima.core.controller.AbstractCoreController;
import com.itheima.user.pojo.ApUserRealname;
import com.itheima.user.service.ApUserRealnameService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
* <p>
* APP实名认证信息表 控制器</p>
* @author 作者
* @since 2021-08-20
*/
@RestController
@RequestMapping("/apUserRealname")
public class ApUserRealnameController extends AbstractCoreController<ApUserRealname> {

    private ApUserRealnameService apUserRealnameService;

    //注入
    @Autowired
    public ApUserRealnameController(ApUserRealnameService apUserRealnameService) {
        super(apUserRealnameService);
        this.apUserRealnameService=apUserRealnameService;
    }

    /***
     * 审核通过
     */
    @PutMapping(value = "/pass/{id}")
    public Result pass(@PathVariable(value = "id")Integer id){
        apUserRealnameService.pass(id);
        return Result.ok();
    }

    /***
     * 驳回功能
     *   1：实名认证记录的ID
     *   2：驳回->将状态改成2
     */
    @PutMapping(value = "/reject")
    public Result reject(@RequestBody ApUserRealname apUserRealname){
        apUserRealnameService.reject(apUserRealname);
        return Result.ok();
    }
}

